import { axios } from '@/utils/request'

const api = {
  getServiceCats: '/alipay/alipay-app/get-service-cats',
  getServiceSchema: '/alipay/alipay-app/get-service-schema',
  serviceListQuery: '/alipay/alipay-app/service-list-query',
  serviceQuery: '/alipay/alipay-app/service-query',
  serviceApply: '/alipay/alipay-app/service-apply',
  serviceDeleted: '/alipay/alipay-app/service-deleted',
  searchServiceorderBatchquery: '/alipay/alipay-app/search-serviceorder-batchquery',
  searchBaseorderModify: '/alipay/alipay-app/search-baseorder-modify',
  searchOrderdetail: '/alipay/alipay-app/search-orderdetail',
  areaList: '/alipay/alipay-app/area',

  listMarketingMaterial: '/alipay/alipay-app/list-marketing-material',
  delMarketingMaterial: '/alipay/alipay-app/del-marketing-material',
  createMarketingMaterial: '/alipay/alipay-app/create-marketing-material',

  activityDeliverylist: '/alipay/alipay-app-shop/activity-delivery-list',
  activityDelivery: '/alipay/alipay-app-shop/activity-delivery',
  activityDeliveryStop: '/alipay/alipay-app-shop/activity-delivery-stop',
  createMarketingDelivery: '/alipay/alipay-app-shop/create-marketing-delivery',

  storeCouponList: '/alipay/ordervoucher/store-coupon-list',
  createActivity: '/alipay/ordervoucher/create',
  detailActivity: '/alipay/ordervoucher/query',
  stopActivity: '/alipay/ordervoucher/stop',
  codecreate: '/alipay/ordervoucher/codecreate',
  codeRefresh: '/alipay/ordervoucher/refresh',
  storeActivityList: '/alipay/ordervoucher/list',
  removeActivity: '/alipay/ordervoucher/remove',

  wifiConf: '/alipay/alipay-app/wifi-conf',
  wifiConfSave: '/alipay/alipay-app/wifi-conf-save',

  voucherCreate: '/alipay/voucher/create',
  voucherList: '/alipay/voucher/list',
  voucherQuery: '/alipay/voucher/query',
  voucherStop: '/alipay/voucher/stop',
  voucherPublish: '/alipay/voucher/publish',
  voucherAppend: '/alipay/voucher/append',
  voucherRemove: '/alipay/voucher/remove',
  voucherModify:'/alipay/voucher/modify'
}

// export default api

/**
 * @des wifi
 */
export function wifiConf(params) {
  return axios({
    url: api.wifiConf,
    method: 'post',
    params
  })
}

/**
 * @des wifi
 * @param {Object} conf // 模板
 */
export function wifiConfSave(params) {
  return axios({
    url: api.wifiConfSave,
    method: 'post',
    params
  })
}

/**
 * @des 服务提报行业类型
 */
export function getServiceCats(params) {
  return axios({
    url: api.getServiceCats,
    method: 'get',
    params
  })
}

/**
 * @des 服务提报行业模板
 * @param {String} cid 类型编号
 * @param {Number} id 小程序ID
 */
export function getServiceSchema(params) {
  return axios({
    url: api.getServiceSchema,
    method: 'get',
    params
  })
}

/**
 * @des 服务提报列表
 * @param {Number} id 小程序ID
 * @param {Number} category_id 行业类型
 * @param {String} service_name 服务名称
 * @param {Number} page_size
 * @param {Number} page_num
 */
export function serviceListQuery(data) {
  return axios({
    url: api.serviceListQuery,
    method: 'post',
    data
  })
}

/**
 * @des 服务提报详情
 * @param {Number} service_code 服务id
 */
export function serviceQuery(service_code) {
  return axios({
    url: api.serviceQuery,
    method: 'post',
    data: {
      service_code
    }
  })
}

/**
 * @des 服务提报申请/修改
 * @param {Number} id
 * @param {Number} service_code 服务id(修改时传入)
 * @param {Number} category_id
 * @param {Object} xxml // 模板
 */
export function serviceApply(data) {
  return axios({
    url: api.serviceApply,
    method: 'post',
    data
  })
}

/**
 * @des 服务提报删除
 * @param {String} service_code ID
 */
export function serviceDeleted(service_code) {
  return axios({
    url: api.serviceDeleted,
    method: 'post',
    data: {
      service_code
    }
  })
}

/**
 * @des 搜索关键字列表
 * @param {Number} id 小程序ID
 * @param {Array}  audit_status_list AUDIT审核 AGREE通过 REJECT拒绝 CANCEL取消 EDIT编辑
 * @param {String} name 服务名称
 * @param {Number} page_size
 * @param {Number} page_num
 */
export function searchServiceorderBatchquery(data) {
  return axios({
    url: api.searchServiceorderBatchquery,
    method: 'post',
    data
  })
}

/**
 * @des 搜索关键字编辑
 * @param {String} id 小程序ID
 * @param {String} biz_type 业务类型 默认：SEARCH_ORDER_CREATE
 * @param {String} opt_type 具体类型 默认：set
 * @param {String} descprise 服务描述
 * @param {Array} key_words 关键字
 * @param {Boolean} can_search 是否可见
 * @param {Number} order_id 修改ID
 */
export function searchBaseorderModify(data) {
  return axios({
    url: api.searchBaseorderModify,
    method: 'post',
    data
  })
}

/**
 * @des 搜索关键字详情
 * @param {String} apply_id 申请单id
 * @param {String} service_code 服务id
 */
export function searchOrderdetail(data) {
  return axios({
    url: api.searchOrderdetail,
    method: 'post',
    data
  })
}

/**
 * @des 省区市列表
 */
export function areaList() {
  return axios({
    url: api.areaList,
    method: 'get'
  })
}

/**
 * @des 支付宝素材列表
 * @param {String} material_name 素材名称
 * @param {String} pageSize
 * @param {String} page
 */
export function listMarketingMaterial(params) {
  return axios({
    url: api.listMarketingMaterial,
    method: 'get',
    params
  })
}

/**
 * @des 支付宝素材删除
 * @param {String} material_id
 */
export function delMarketingMaterial(material_id) {
  return axios({
    url: api.delMarketingMaterial,
    method: 'post',
    data: {
      material_id
    }
  })
}

/**
 * @des 创建支付宝素材
 * @param {String} material_name 素材名称
 * @param {Object} material_fields
 * mainTitle 主标题、subTitle副标题、sellingTagMulti推荐标签、actionPoint行动点
 * verticalImageForService 3:4纵图
 * horizontalImageForService 4:3横图
 * squareImageForService 1:1方图
 */
export function createMarketingMaterial(data) {
  return axios({
    url: api.createMarketingMaterial,
    method: 'post',
    data
  })
}

/**
 * @des 推广计划列表
 * @param {String} mini_id 小程序ID
 * @param {Number} delivery_booth_code 1
 * @param {String} page
 */
export function activityDeliverylist(params) {
  return axios({
    url: api.activityDeliverylist,
    method: 'get',
    params
  })
}

/**
 * @des 推广计划详情（未对过）
 * @param {String} id
 */
export function activityDelivery(id) {
  return axios({
    url: api.activityDelivery,
    method: 'post',
    data: {
      id
    }
  })
}

/**
 * @des 推广计划详情
 * @param {String} mini_id
 */
export function activityDelivery2(data) {
  return axios({
    url: api.activityDelivery,
    method: 'post',
    data
  })
}

/**
 * @des 推广计划禁用
 * @param {String} id
 */
export function activityDeliveryStop(id) {
  return axios({
    url: api.activityDeliveryStop,
    method: 'post',
    data: {
      id
    }
  })
}

/**
 * @des 推广计划新增
 * @param {String} mini_id 小程序id
 * @param {Object} params_data
 * delivery_name 名称、delivery_begin_time 开始时间、delivery_end_time 结束时间
 * delivery_booth_code 1、delivery_single_send_config 1
 * material_id_list、service_code_list（支付宝素材ids,服务提报ids）
 */
export function createMarketingDelivery(data) {
  return axios({
    url: api.createMarketingDelivery,
    method: 'post',
    data
  })
}

/**
 * @des 系统券列表
 * @param {String} pageNo
 * @param {String} pageSize
 */
export function storeCouponList(params) {
  return axios({
    url: api.storeCouponList,
    method: 'get',
    params
  })
}

/**
 * @des 创建商家券活动
 * @param {String} id 小程序ID
 * @param {String} coupon_id
 * @param {String} publish_start_time
 * @param {String} publish_end_time
 */
export function createActivity(data) {
  return axios({
    url: api.createActivity,
    method: 'post',
    data
  })
}

/**
 * @des 查询商家券活动
 * @param {String} alipay_activity_id
 */
export function detailActivity(data) {
  return axios({
    url: api.detailActivity,
    method: 'post',
    data
  })
}

/**
 * @des 停止优惠券
 * @param {String} alipay_activity_id
 */
export function stopActivity(data) {
  return axios({
    url: api.stopActivity,
    method: 'post',
    data
  })
}

/**
 * @des 生成商家券券码
 * @param {String} activity_ordervoucher_id
 * @param {String} count
 */
export function codecreate(data) {
  return axios({
    url: api.codecreate,
    method: 'post',
    data
  })
}

/**
 * @des 更新券数量
 * @param {String} alipay_activity_id
 */
export function codeRefresh(data) {
  return axios({
    url: api.codeRefresh,
    method: 'post',
    data
  })
}

/**
 * @des 查询商家券活动列表
 * @param {String} publish_start_time
 * @param {String} publish_end_time
 * @param {String} status 0：全部 1：活动中 2：已结束
 */
export function storeActivityList(data) {
  return axios({
    url: api.storeActivityList,
    method: 'post',
    data
  })
}

/**
 * @des 删除商家券活动
 * @param {String} alipay_activity_id
 */
export function removeActivity(data) {
  return axios({
    url: api.removeActivity,
    method: 'post',
    data
  })
}

// 代金券api start
/**
 * @des 创建代金券
 * @param {String} publish_start_time 发放开始时间
 * @param {String} publish_end_time 发放结束时间
 * @param {Number} quantity 券数量
 * @param {String} ceiling_amount 最大优惠金额
 * @param {Number} wait_days_after_receive 相对时间，领取几天后可用
 * @param {Object} voucher_display_pattern_info 信息
 * @param {String} goods_name 商品名称
 * @param {String} goods_description 商品描述
 */
export function voucherCreate(data) {
  return axios({
    url: api.voucherCreate,
    method: 'post',
    data
  })
}

export function voucherList(data) {
  return axios({
    url: api.voucherList,
    method: 'post',
    data
  })
}

/**
 * @des 停止活动
 *  */
export function voucherStop(data) {
  return axios({
    url: api.voucherStop,
    method: 'post',
    data
  })
}

/**
 * @des 激活活动
 *  */
export function voucherPublish(data) {
  return axios({
    url: api.voucherPublish,
    method: 'post',
    data
  })
}

/**
 * @des 追加券数量
 *  */
 export function voucherAppend(data) {
  return axios({
    url: api.voucherAppend,
    method: 'post',
    data
  })
}

/**
 * @des 删除支付券活动
 *  */
 export function voucherRemove(data) {
  return axios({
    url: api.voucherRemove,
    method: 'post',
    data
  })
}

/**
 * @des 编辑支付券活动
 *  */
 export function voucherModify(data) {
  return axios({
    url: api.voucherModify,
    method: 'post',
    data
  })
}

/**
 * @des 获取支付券详情
 *  */
 export function voucherQuery(data) {
  return axios({
    url: api.voucherQuery,
    method: 'post',
    data
  })
}
// 代金券api end
